package com.zh.utils;

import org.apache.shiro.crypto.hash.Hash;
import org.apache.shiro.util.StringUtils;

import java.text.DateFormat;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description:
 * @ClassName TestLong
 * @date: 2021.03.02 17:48
 * @Author: zhanghang
 */
public class TestLong {
    public static void main(String[] args) {
        String str = null;
        System.out.println();
        String startTime = "01:30";
        String endTime = "06:20";
        String[] split = startTime.split(":");
        Double startTimeHH = Double.valueOf(split[0]);
        Double startTimemm = Double.valueOf(split[1]);
        System.out.println("HH:"+startTimeHH+ ",mm:"+startTimemm);
        String[] end = endTime.split(":");
        Double endTimeHH = Double.valueOf(end[0]);
        Double endTimemm = Double.valueOf(end[1]);
        System.out.println("HH:"+endTimeHH+ ",mm:"+endTimemm);
        Double startmm = startTimeHH * 60 + startTimemm;
        Double endmm = endTimeHH * 60 + endTimemm;
        System.out.println("startmm:"+startmm+ ",endmm:"+endmm);
        Double result =  endmm - startmm;
        System.out.println("result:"+result/60);
        String format = String.format("%.1f", +result/60);
        System.out.println(format);
    }
}
